package br.com.view;

public class FabricaHtml {
	public static String criarDiv(String clas, String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<div class=\""+clas+"\" id=\""+clas+"\">\n");
		sb.append(conteudo);
		sb.append("</div>\n");
		return sb.toString();
	}
	public static String criarDivGrafic(String id){
		StringBuilder sb = new StringBuilder();
		sb.append("<div id=\""+id+"\" style=\"min-width: 500px; height: 300px; margin: 0 auto; float: right;\">\n");
		sb.append("</div>\n");
		return sb.toString();
	}
	public static String criarDivGrafic(String id, int largura, int altura){
		StringBuilder sb = new StringBuilder();
		sb.append("<div id=\""+id+"\" style=\"min-width: "+largura+"px; height: "+altura+"px; margin: 0 auto; float: right;\">\n");
		sb.append("</div>\n");
		return sb.toString();
	}
	public static String criarDivSemFec(String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<div class=\""+clas+"\" id=\""+clas+"\">\n");
		return sb.toString();
	}
	public static String criarDivSemFec(String id, String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<div id=\""+id+"\" class=\""+clas+"\">\n");
		return sb.toString();
	}
	public static String criarDivSemFec(String id, String clas, String title){
		StringBuilder sb = new StringBuilder();
		sb.append("<div id=\""+id+"\"  class=\""+clas+"\" title=\""+title+"\">\n");
		return sb.toString();
	}
	public static String fechaDiv(){
		StringBuilder sb = new StringBuilder();
		sb.append("</div>\n");
		return sb.toString();
	}
	public static String criarUl(String conteudo, String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<ul class=\""+clas+"\">");
		sb.append(conteudo);
		sb.append("</ul>\n");
		return sb.toString();
	}
	public static String criarLi(String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<li>");
		sb.append(conteudo);
		sb.append("</li>\n");
		return sb.toString();
	}
	//trabalhando menus complexos
	public static String criarLiNotClose(){
		StringBuilder sb = new StringBuilder();
		sb.append("<li>\n");
		return sb.toString();
	}
	public static String liClose(){
		StringBuilder sb = new StringBuilder();
		sb.append("</li>\n");
		return sb.toString();
	}
	public static String criarUlNotClose(){
		StringBuilder sb = new StringBuilder();
		sb.append("<ul>\n");
		return sb.toString();
	}
	public static String ulClose(){
		StringBuilder sb = new StringBuilder();
		sb.append("</ul>\n");
		return sb.toString();
	}
	//fim menus complexos
	public static String criarLegend(String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<legend>\n");
		sb.append(conteudo);
		sb.append("</legend>\n");
		return sb.toString();
	}
	public static String criarLabel(String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<label>");
		sb.append(conteudo);
		sb.append("</label>\n");
		return sb.toString();
	}
	public static String criarAsp(String href, String title, String clas, String nome){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+"\" title=\""+title+"\" class=\""+clas+"\" >"+nome+"</a>");
		return sb.toString();
	}
	public static String criarAspJS(String href, String title, String clas, String nome){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+" title=\""+title+"\" class=\""+clas+"\" >"+nome+"</a>");
		return sb.toString();
	}
	public static String criarAsp(String href, String title, String id, String clas, String nome, String value){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+"\" title=\""+title+"\" class=\""+clas+"\" id=\""+id+"\" value=\""+value+"\" >"+nome+"</a>");
		return sb.toString();
	}
	public static String criarAsp(String href, String title, String id, String clas, String nome, int value){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+"\" title=\""+title+"\" class=\""+clas+"\" id=\""+id+"\" value=\""+value+"\" >"+nome+"</a>");
		return sb.toString();
	}
	
	public static String criarAcp(String href, String nome, String parametro){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+"?"+parametro+"\">"+nome+"</a>");
		return sb.toString();
	}
	public static String criarAcp(String href, String nome){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+"\">"+nome+"</a>");
		return sb.toString();
	}
	public static String criarFieldsetIni(){
		StringBuilder sb = new StringBuilder();
		sb.append("<fieldset>");
		return sb.toString();
	}
	public static String criarFieldsetFim(){
		StringBuilder sb = new StringBuilder();
		sb.append("</fieldset>\n");
		return sb.toString();
	}
	public static String criarInputs(String label, String type, String name, String value){
		StringBuilder sb = new StringBuilder();
		sb.append("<label>"+label);
		sb.append("<input type=\""+type+"\" name=\""+name+"\" id=\""+name+"\" value=\""+value+"\" />\n");
		sb.append("</label>");
		return sb.toString();
	}	
	
	public static String criarLabel(String forr,String name){
		StringBuilder sb = new StringBuilder();
		sb.append("<label for="+forr+">"+name);
		sb.append("</label>\n");
		return sb.toString();
	}
	public static String criarInput(String type,String name, String clas, String value){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" id=\""+name+"\" name=\""+name+"\" value=\""+value+"\" class=\""+clas+"\" />\n");
		return sb.toString();
	}
	
	public static String criarInputs(String label, String type, String name){
		StringBuilder sb = new StringBuilder();
		sb.append("<label>"+label);
		sb.append("<input type=\""+type+"\" name=\""+name+"\" id=\""+name+"\" />\n");
		sb.append("</label>");
		return sb.toString();
	}	
	public static String criarInputsSpecf(String type, String name,char valor,String texto, String caract){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" name=\""+name+"\" id=\""+name+"\" value=\""+valor+"\" "+caract+" />"+texto+"\n");
		return sb.toString();
	}
	public static String criarInputsSpecf(String type, String name,String id,char valor,String texto, String caract){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" name=\""+name+"\" id=\""+id+"\" value=\""+valor+"\" "+caract+" />"+texto+"\n");
		return sb.toString();
	}
	public static String criarInputsOcultos(String type, String name){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" id=\""+name+"\" name=\""+name+"\" value=\"\" />\n");
		return sb.toString();
	}
	public static String criarInputsOcultos(String type, String id,String name,int valor){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" id=\""+id+"\" name=\""+name+"\" value=\""+valor+"\" />\n");
		return sb.toString();
	}
	public static String criarInputsOcultos(String type, String id,String name,String valor){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" id=\""+id+"\" name=\""+name+"\" value=\""+valor+"\" />\n");
		return sb.toString();
	}
	public static String criarInputsOcultos(String type, String name, String valor){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" id=\""+name+"\" name=\""+name+"\" value=\""+valor+"\" />\n");
		return sb.toString();
	}
	public static String criarInputBotao(String type, String clas,String value){
		StringBuilder sb = new StringBuilder();
		sb.append("<input type=\""+type+"\" class=\""+clas+"\"  value=\""+value+"\"  />\n");
		return sb.toString();
	}
	public static String criaTextArea(String label, int coluna,int rows,String name){
		StringBuilder sb = new StringBuilder();
		sb.append("<label>"+label);
		sb.append("<textarea cols=\""+coluna+"\" rows=\""+rows+"\" name=\""+name+"\"></textarea>\n");
		sb.append("</label>");
		return sb.toString();
	}
	public static String criaTextArea(int coluna,int rows,String name){
		StringBuilder sb = new StringBuilder();
		sb.append("<textarea cols=\""+coluna+"\" rows=\""+rows+"\" id=\""+name+"\" name=\""+name+"\"></textarea>\n");
		return sb.toString();
	}
	public static String criaTextArea(int coluna,int rows,String name, String clas, String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<textarea cols=\""+coluna+"\" rows=\""+rows+"\" class=\""+clas+"\" id=\""+name+"\" name=\""+name+"\">"+conteudo+"</textarea>\n");
		return sb.toString();
	}
	public static String criaTextArea(int coluna,int rows,String name, String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<textarea cols=\""+coluna+"\" rows=\""+rows+"\" class=\""+clas+"\" id=\""+name+"\" name=\""+name+"\"></textarea>\n");
		return sb.toString();
	}
	public static String criaTextArea(String label, int coluna,int rows, String name, String value){
		StringBuilder sb = new StringBuilder();
		sb.append("<label>"+label);
		sb.append("<textarea cols=\""+coluna+"\" rows=\""+rows+"\" name=\""+name+"\" >"+value+"</textarea>\n");
		sb.append("</label>");
		return sb.toString();
	}
	public static String criarSelect(String name,String id){
		StringBuilder sb = new StringBuilder();
		sb.append("<select name=\""+name+"\" id=\""+id+"\">\n");
		return sb.toString();
	}
	
	public static String criarSelect(String name,String id, String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<select class=\""+clas+"\" name=\""+name+"\" id=\""+id+"\">\n");
		return sb.toString();
	}
	
	public static String criarOption(int value,String apresent){
		StringBuilder sb = new StringBuilder();
		sb.append("<option value=\""+value+"\">"+apresent+"</option>\n");
		return sb.toString();
	}
	public static String criarOptions(int value,String apresent, String situacao){
		StringBuilder sb = new StringBuilder();
		if(situacao.equals("P")){
			sb.append("<option value=\""+value+"\" class=\""+situacao+"\">"+apresent+"</option>\n");
		}else{
			sb.append("<option value=\""+value+"\" class=\""+situacao+"\">"+apresent+"</option>\n");
		}
		return sb.toString();
	}
	public static String criarOptions(int value,String selected, String apresent, String situacao){
		StringBuilder sb = new StringBuilder();
		if(situacao.equals("P")){
			sb.append("<option value=\""+value+"\" "+selected+" class=\""+situacao+"\">"+apresent+"</option>\n");
		}else{
			sb.append("<option value=\""+value+"\" "+selected+" class=\""+situacao+"\">"+apresent+"</option>\n");
		}
		return sb.toString();
	}
	public static String criarOption(int value,String selected,String apresent){
		StringBuilder sb = new StringBuilder();
		sb.append("<option value=\""+value+"\" "+selected+">"+apresent+"</option>\n");
		return sb.toString();
	}
	public static String criarOption(char value,String selected,String apresent){
		StringBuilder sb = new StringBuilder();
		sb.append("<option value=\""+value+"\" "+selected+">"+apresent+"</option>\n");
		return sb.toString();
	}
	public static String criarOption(char value,String apresent){
		StringBuilder sb = new StringBuilder();
		sb.append("<option value=\""+value+"\">"+apresent+"</option>\n");
		return sb.toString();
	}
	public static String fecharSelect(){
		StringBuilder sb = new StringBuilder();
		sb.append("</select>\n");
		return sb.toString();
	}
	public static String criarForm(String action, String method){
		StringBuilder sb = new StringBuilder();
		sb.append("<form action=\""+action+"\" id=\""+action+"\" method=\""+method+"\">\n");
		return sb.toString();
	}
	public static String criarForm(String id, String action, String method){
		StringBuilder sb = new StringBuilder();
		sb.append("<form action=\""+action+"\" id=\""+id+"\" method=\""+method+"\">\n");
		return sb.toString();
	}
	public static String fecharForm(){
		StringBuilder sb = new StringBuilder();
		sb.append("</form>\n");
		return sb.toString();
	}
	//tabelas
	public static String criarInicioTabela(){
		StringBuilder sb = new StringBuilder();
		sb.append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"tabela\">\n");
		return sb.toString();
	}
	public static String criarTrs(String formCss,String conteudo){
		//as chamadas css sera tb-topo e tb-base
		StringBuilder sb = new StringBuilder();
		sb.append("<tr class=\""+formCss+"\" id=\""+formCss+"\">\n");
		sb.append(conteudo);
		sb.append("</tr>\n");
		return sb.toString();
	}
	public static String criarTds(int width, String valor){
		StringBuilder sb = new StringBuilder();
		sb.append("<td width="+width+">\n");
		sb.append(valor);
		sb.append("</td>\n");
		return sb.toString();
	}
	public static String criarTds(int width, double valor){
		StringBuilder sb = new StringBuilder();
		sb.append("<td width="+width+">\n");
		sb.append(valor);
		sb.append("</td>\n");
		return sb.toString();
	}
	public static String fecharTabela(){
		StringBuilder sb = new StringBuilder();
		sb.append("</table>\n");
		return sb.toString();
	}
	public static String criarExibeConteudo(String nome, String exibicao){
		StringBuilder sb = new StringBuilder();
		sb.append("<b>"+nome+"</b>"+exibicao+"<br />");
		return sb.toString();
	}
	public static String imgemLink(String linkImag){
		StringBuilder sb = new StringBuilder();
		sb.append("<img src=\"./imagens/imgPadrao/"+linkImag+"\" />");
		return sb.toString();
	}
	public static String ParagrafIn() {
		StringBuilder sb = new StringBuilder();
		sb.append("<p>");
		return sb.toString();
	}
	public static String ParagrafFi() {
		StringBuilder sb = new StringBuilder();
		sb.append("</p>");
		return sb.toString();
	}
	public static String criarHs(int tamanho, String conteudo, String clas) {
		StringBuilder sb = new StringBuilder();
		sb.append("<h"+tamanho+" class=\""+clas+"\">"+conteudo+"</h"+tamanho+">");
		return sb.toString();
	}
	public static String criarImagem(String img, String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<img src=\"./imagens/"+img+"\" class=\""+clas+"\"></img>");
		return sb.toString();
	}
	public static String criarParagraf(String clas, String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<p class=\""+clas+"\">");
		sb.append(conteudo);
		sb.append("</p>\n");
		return sb.toString();
	}
	public static String criarH(String clas, int h, String conteudo){
		StringBuilder sb = new StringBuilder();
		sb.append("<h"+h+" class=\""+clas+"\">\n");
		sb.append(conteudo);
		sb.append("</h"+h+">\n");
		return sb.toString();
	}
	public static String criarSpan(String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<span class=\""+clas+"\">\n");
		sb.append("</span>\n");
		return sb.toString();
	}
	public static String criarAspIni(String href, String title, String clas){
		StringBuilder sb = new StringBuilder();
		sb.append("<a href=\""+href+"\" title=\""+title+"\" class=\""+clas+"\" >\n");
		return sb.toString();
	}
	public static String criarAspIni(){
		StringBuilder sb = new StringBuilder();
		sb.append("</a>\n");
		return sb.toString();
	}
}
